from django.template import Library, Node
from comunidadcyt.Eventos.models import Eventos
from django.db.models import Q

register = Library()
    
class FilterNoPrivacyEvents(Node):
    def render(self,context):
        context['no_privacy_events'] = Eventos.objects.filter(Q(privacidad = '') | Q(privacidad__iexact = 'Todo el mundo')).all()
        return ''
    
def no_privacy_events(parser,token):
    return FilterNoPrivacyEvents()

no_privacy_events = register.tag(no_privacy_events)